An imaging device employed in an imaging apparatus such as a digital camera has a light receiving section having a plurality of photo diodes arranged in a matrix. These photo diodes serve as individual pixels for imaging purposes. Incident light is subjected to photoelectrical conversion on a pixel-by-pixel basis to generate electric charge, which is output from the imaging device. The pixels formed in the light receiving section may include those which are defective and thus fail to properly operate. Such pixels include black defect pixels that always appear as a dark point (i.e., black point) and white defect pixels that always appear as a bright point (i.e., white point).
Technology for correcting defective pixels include replacing the value of a pixel of interest with the value of a pixel adjacent to the pixel of interest. In this method, the pixel of interest is ascertained to be a white defect when the value of the pixel of interest is larger than a value obtained by adding a predetermined threshold to the maximum value of surrounding pixels. In such a case, the value of the pixel of interest is replaced with the maximum value of the surrounding pixels. Further, the pixel of interest is ascertained to be a black defect when the value of the pixel of interest is smaller than a value obtained by subtracting a predetermined threshold from the minimum value of surrounding pixels. In such a case, the value of the pixel of interest is replaced with the minimum value of the surrounding pixels. In other cases, the pixel of interest is ascertained to be non-defective, and the value of the pixel of interest is kept as it is.
The above-noted technology for correcting defective pixels successfully avoids the situation in which excessive correction ends up worsening an image. However, insufficient correction may create a case in which a corrected pixel is conspicuous in the resultant image. For example, there may be a straight-line boundary between a black area and a white area, and a white defect pixel may be present in the black area at a point abutting the border. In this case, the value of this defective pixel present in the black area is replaced with a white value since the maximum value of the surrounding pixels around this defective pixel is white, resulting in the corrected pixel being conspicuous.
In consideration of these, it is ideally preferable to detect the directivity of an image such as an edge direction and to use an appropriate corrective pixel value responsive to the detected directivity.
For example, a certain technology for correcting defective pixels based on image directivity (e.g., Patent Document 1) ascertains whether a pixel of interest is a defective pixel by use of an ascertaining method similar to the one used in the above-noted related art, and maintains the value of the pixel of interest without any change in the case in which the pixel of interest is not a defective pixel.
In the case in which the pixel of interest is a defective pixel, the direction in which changes in pixel values are relatively small is identified based on the values of surrounding pixels around the pixel of interest, followed by correcting the value of the pixel of interest based on the values of the surrounding pixels situated in the identified direction. Such a correction method may, for example, replace the value of a pixel of interest with an average of the value of a pixel immediately above the pixel of interest and the value of a pixel immediately below the pixel of interest in the case of a vertical direction being selected. Further, in the case of a horizontal direction being selected, the value of a pixel of interest may be replaced with an average of the value of a pixel on the immediate left of the pixel of interest and the value of a pixel on the immediate right of the pixel of interest. In the case of a direction sloping upward to the right being selected, the value of a pixel of interest may be replaced with an average of the value of a pixel on the immediate upper right of the pixel of interest and the value of a pixel on the immediate lower left of the pixel of interest. Moreover, in the case of a direction sloping upward to the left being selected, the value of a pixel of interest may be replaced with an average of the value of a pixel on the immediate upper left of the pixel of interest and the value of a pixel on the immediate lower right of the pixel of interest. When no direction is identified, the value of the pixel of interest may be replaced with an average of all the surrounding pixels.
The technology for correcting defective pixels described above attends to correction by taking into account the direction of an edge in an image, so that the correction is rarely insufficient, resulting in the corrected pixel value being likely to fit in the image. A failure to make a proper determination of the direction, however, may end up making the image worse than the original image. For example, an image may have a thin black line having a width of one pixel and extending in a horizontal direction against the white background. A pixel of interest may be situated on the black line. The values of pixels of the black line may have slight variation from pixel to pixel whereas the pixels in the white background may have approximately the same constant value. In this case, an attempt to identify the direction in which changes in pixel values are relatively small based on the values of surrounding pixels around the pixel of interest may ends up selecting the vertical direction as the direction of relatively small changes in pixel values. This is because the value of a pixel immediately above the pixel of interest and the value of a pixel immediately below the pixel of interest are approximately the same. As a result, the value of the pixel of interest situated on the black line is replaced with an average of the value of a pixel (i.e., white pixel) immediately above the pixel of interest and the value of a pixel (i.e., white pixel) immediately below the pixel of interest. The black line is thus disconnected halfway through.
[Patent Document 1] Japanese Laid-open Patent Publication No. 2005142997
[Patent Document 2] Japanese Laid-open Patent Publication No. 2003111088
[Patent Document 3] Japanese Laid-open Patent Publication No. 2006148230